﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Demo.Framework.Camera
{
    public abstract class BaseCamera
    {
        public Matrix View { get; set; }
        public Matrix Projection { get; set; }
        protected GraphicsDevice GraphicsDevice { get; set; }

        public BaseCamera(GraphicsDevice graphicsDevice)
        {
            this.GraphicsDevice = graphicsDevice;
            GeneratePerspectiveProjectionMatrix(MathHelper.PiOver4);
        }

        private void GeneratePerspectiveProjectionMatrix(float fieldOfView)
        {
            PresentationParameters pp = GraphicsDevice.PresentationParameters;
            float aspectRatio = (float) pp.BackBufferWidth/(float) pp.BackBufferHeight;
            this.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), aspectRatio, 0.1f,
                                                                  1000000.0f);
        }

        public virtual void Update(GameTime gameTime)
        {

        }
    }
}
